<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@taglib prefix="zhangfn" uri="http://github.com/zhangkaitao/tags/zhang-functions" %>
<%@taglib prefix="shiro" uri="http://shiro.apache.org/tags" %>
<html>
<head>
    <title></title>
    <link rel="stylesheet" href="${pageContext.request.contextPath}/static/css/css.css">
    <script src="${pageContext.request.contextPath}/static/js/jquery-1.11.0.min.js"></script>
    <script type="text/javascript">
		function selectLang(lang)
		{
			
			window.location.href="${pageContext.request.contextPath}//news/"+lang;
			
		}
	
	</script>
</head>
<body>

<c:if test="${not empty msg}">
    <div class="message">${msg}</div>
</c:if>
<select onchange="selectLang(this.value);">
		<option value="zh_cn"<c:if test="${sessionScope.local_lang=='zh_cn'}"> selected="selected"</c:if> >简体中文</option>
		<option value="zh_hk"<c:if test="${sessionScope.local_lang=='zh_hk'}"> selected="selected"</c:if>>繁體中文</option>
		<option value="en"<c:if test="${sessionScope.local_lang=='en'}"> selected="selected"</c:if>>English</option>
	</select>
	<br/>
<shiro:hasPermission name="news:create">
    <a href="${pageContext.request.contextPath}/news/create">新闻新增</a><br/>
</shiro:hasPermission>
<table class="table">
    <thead>
        <tr>
            <th>名称</th>
            <th>新闻种类</th>
            <th>CDN链接地址</th>
            <th>备注</th>
            <th>建立时间</th>
            <th>更新时间</th>
            <th>操作</th>
        </tr>
    </thead>
    <tbody>
        <c:forEach items="${newsList}" var="news">
            <tr>
                <td>${news.name}</td>
                <td><c:if test="${news.code=='market_comments'}">市场动态</c:if>
                <c:if test="${news.code=='market_reports'}">市场焦点</c:if>
                </td>
                <td><a href="${news.content}" target="_blank">${news.content}</a></td>
                <td>${news.remark}</td>
                <td>${news.setup_time}</td>
                <td>${news.update_time}</td>
                <td>
                    <shiro:hasPermission name="news:update">
                        <a href="${pageContext.request.contextPath}/news/${news.id}/update">修改</a>
                    </shiro:hasPermission>

                    <shiro:hasPermission name="news:delete">
                        <a href="${pageContext.request.contextPath}/news/${news.id}/delete">删除</a>
                    </shiro:hasPermission>
                </td>
            </tr>
        </c:forEach>
    </tbody>
</table>

</body>
</html>